At the time of writing Numbers, the Jews, just like most of their neighbours were Iron Age peasants living a simple desert life using social values which favoured patriarchy. The archaeology of Israel seems to indicate that their material culture was rather behind the times in its primitiveness.
The fact that these objectionable regulations were projected on to their Idol Yahweh just shows how the prevailing human mores were used to describe their totemic god. If a compassionate and all powerful intelligent god truly existed, surely he would have enlightened them with more compassionate and intelligent ideas? But no, the Bible only reflects the contemporary base human values of perpetual warfare and territorial gain, men first and girls as commodities, slaughter all those who don't believe in your god. The Bible is uninspired.